package exception;

import java.io.FileNotFoundException;
import java.nio.channels.AcceptPendingException;

import javax.management.modelmbean.XMLParseException;

class Person{
	
}


class A{
	// 此方法可能抛出两种非运行时异常
	public void test() throws FileNotFoundException, ClassCastException{
		throw new FileNotFoundException();
	}
}

class B extends A{
	@Override
	public void test() throws FileNotFoundException, ClassCastException{
		// 子类重写父类的方法，不能比父类抛出更多的非运行式异常
	}
}

class C extends A{
	@Override
	public void test() throws FileNotFoundException, ClassCastException{
		// 子类重写父类的方法，不能比父类抛出更多的非运行式异常
	}
}

public class ExtendsExceptionDemo {
	public static void main(String[] args) {
		A a = new C();
		try {
			a.test();
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (ClassCastException e) {
			e.printStackTrace();
		} 
	}
}
